package com.xlh.Model;

import android.content.Context;
import android.database.Cursor;

import com.xlh.Utils.DBManager;
import com.xlh.bean.DataBase.UserBean;

/**
 * Created by fang on 2018-01-16.
 */

public class ColorConfModel extends DBManager {



    public ColorConfModel(Context context) {
        super(context);
        setTableName("color_conf");
    }


    //order by id desc

    public void add(String tagname,String colorstr){
        //只保留一条记录
        getDb().execSQL(String.format("delete from %s",getTableName()));
        getDb().execSQL(String.format("insert into %s (tagname,colorstr)values(?,?)",getTableName()),new String[]{tagname,colorstr});
    }


    public Cursor getList(){
        return getDb().rawQuery(String.format("select * from %s order by id desc",getTableName()),null);
    }

}
